using System;
using System.IO;

namespace Banco
{
    public class Log
    {
        private static StreamWriter writer;

        public static string LogFile { get; set; }

        public static void Save(string message, Exception ex)
        {
            //try
            //{
            //    string logMessage = "\n ******* " + DateTime.Now + " ******* \n" + message + " **** \n";
            //    logMessage = logMessage + ex.Message + "\n";
            //    writer = GetStreamWriter();
            //    writer.WriteLine(logMessage);
            //    writer.WriteLine(ex.StackTrace);
            //}
            //finally
            //{
            //    if (writer != null)
            //    {
            //        writer.Close();
            //    }
            //}
        }

        public static void Save(Exception ex)
        {
            //try
            //{
            //    string logMessage = "\n ******* " + DateTime.Now + " ******* \n";
            //    logMessage = logMessage + ex.Message + "\n";
            //    writer = GetStreamWriter();
            //    writer.WriteLine(logMessage);
            //    writer.WriteLine(ex.StackTrace);
            //}
            //finally
            //{
            //    if (writer != null)
            //    {
            //        writer.Close();
            //    }
            //}
        }

        public static void Save(string mensagem)
        {
            //try
            //{
            //    string logMessage = "\n ******* " + DateTime.Now + " ******* \n" + mensagem;
            //    writer = GetStreamWriter();
            //    writer.WriteLine(logMessage);
            //}
            //finally
            //{
            //    if (writer != null)
            //    {
            //        writer.Close();
            //    }
            //}
        }

        private static StreamWriter GetStreamWriter()
        {
            //string path;

            //if (!string.IsNullOrEmpty(LogFile))
            //{
            //    path = LogFile;
            //    LogFile = null;
            //}
            //else
            //{
            //    path = LeitorFwConfig.Configurations["LogPath"];
            //}

            //FileStream fileStream = File.Open(path, FileMode.Append, FileAccess.Write);
            //writer = new StreamWriter(fileStream);
            //writer.Flush();
            //return writer;
            return null;
        }
    }
}